<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/4/21
 * Time: 13:33
 */

namespace Modules\Shop\Http\Controllers;

use Illuminate\Support\Facades\Request;
use Modules\Shop\Service\RoadRescueService;

class RoadRescueController extends BaseController
{

    /**
     *  道路救援服务类型列表
     *  hinq 2020 6 2
     *
     **/
    public function type_list(){
        $arr_list = RoadRescueService::type_list();
        return hello_success('ok',$arr_list);
    }


    /**
     *  获取指定道路救援机构设置的所有服务类型列表信息
     *  hinq 2020 6 2
     *
     **/
    public function index( Request $request ){
        $arr_input = (array) $request::all();
        $arr_list = RoadRescueService::get_list( (array) $arr_input );
        return view("shop::road_rescue.index" , $arr_list['data']);
    }

    /**
     *  设置服务类型 视图
     *  hinq 2020 6 2
     *
     **/
    public function create(){
        $arr_list = RoadRescueService::type_list();
        return view("shop::road_rescue.create" , ['type_list' => $arr_list ]);
    }

    /**
     *  保存设置的服务类型信息
     *  hinq 2020 6 2
     *
     **/
    public function store( Request $request ){
        $arr_input = (array) $request::all();
        return RoadRescueService::store( (array) $arr_input );
    }

    /**
     *  编辑服务类型 视图
     *  hinq 2020 6 2
     *
     **/
    public function edit( Request $request ){
        $id = (int) $request::get('id');
        $arr_list = RoadRescueService::get_one( (int) $id );
        $type_list = RoadRescueService::type_list();
        return view("shop::road_rescue.edit" , ['info' => $arr_list['data']  , 'type_list' => $type_list  ]);
    }

    /**
     *  更新服务类型 数据
     *  hinq 2020 6 2
     *
     **/
    public function update( Request $request ){
        $arr_input = (array) $request::all();
        return RoadRescueService::update( (array) $arr_input );
    }

    /**
     *  订单列表
     *  hinq 2020 4 28
     **/
    public function order_list(){
        $arr_search = (array) Request::all();
        $arr_list = RoadRescueService::order_list( (array) $arr_search );
        return view('shop::road_rescue.order_list' , $arr_list['data'] );
    }


    /**
     *  订单详情
     *  hinq 2020 4 29
     *
     **/
    public function order_detail(){
        $nId = (int) Request::get('id');
        $arr_list = RoadRescueService::order_detail( (int) $nId );
        return view('shop::road_rescue.order_detail' , ['info' => $arr_list['data'] ] );
    }


    /**
     *  审核退款信息
     *  hinq 2020 4 30
     **/
    public function order_shenhe(){
        $arr_input = (array) Request::all();
        return RoadRescueService::order_shenhe( (array) $arr_input );
    }

}